#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
int main()
{
int ret=fork();
if(ret>0)
{
  //父进程
  int status=0;
   waitpid(ret,&status,0);
   while(1)
   {
  printf("I am parent task, my pid is %d,my ppid is %d,ret=%d\n",getpid(),getppid(),ret);
   sleep(1);
   }
}


if(ret==0)
{
//子进程
  while(1)
  {
printf("I am child task,my pid is %d,my ppid is %d\n",getpid(),getppid());
  sleep(1);
  }
}
  exit(10);
}
